package com.gm.census.web.interceptors;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class AccessInterceptor extends LoginInterceptor {

	@Override
	public boolean preHandle(HttpServletRequest request,
			HttpServletResponse response, Object handler) throws Exception {
		boolean logged = super.preHandle(request, response, handler);
		if (logged && !getUserService().isUserAdmin()) {
			response.sendRedirect("/census");
			return false;
		} else
			return logged;
	}

}
